/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gestion.model;

import java.awt.Color;

/**
 *
 * @author isen
 */
public class Voiture {

    private int id;
    private String brand;
    private String model;
    private int sellerId;
    private float sellsPrice;
    private float buyPrice;
    private float weight;
    private Color color;
    private int year;
    private state generalState;
    private float repareCosts;

    public enum state {

        NEW, CORRECT, USED, BAD
    }

    public String getBrand() {
        return brand;
    }

    public float getBuyPrice() {
        return buyPrice;
    }

    public Color getColor() {
        return color;
    }

    public state getGeneralState() {
        return generalState;
    }

    public void setGeneralState(state generalState, float repareCosts) {
        this.generalState = generalState;
        this.repareCosts += repareCosts;
    }

    public int getId() {
        return id;
    }

    public String getModel() {
        return model;
    }

    public int getSellerId() {
        return sellerId;
    }

    public float getSellsPrice() {
        return sellsPrice;
    }

    public float getWeight() {
        return weight;
    }

    public int getYear() {
        return year;
    }

    public Voiture(String brand, String model, int sellerId, float sellsPrice, float buyPrice, float weight, Color color, int year, state generalState) {
        if ((brand != null) &&( model!= null) && (sellerId >= 0) && (sellsPrice >= 0) && (buyPrice > 0) && (weight > 0) && (year > 1800)) {
            this.brand = brand;
            this.model = model;
            this.sellerId = sellerId;
            this.sellsPrice = sellsPrice;
            this.buyPrice = buyPrice;
            this.weight = weight;
            this.color = color;
            this.year = year;
            this.generalState = generalState;
        }else{
            throw new IllegalArgumentException();
        }

    }

    public Voiture(int id, String brand, String model, int sellerId, float sellsPrice, float buyPrice, float weight, Color color, int year, state generalState) {
        this(brand, model, sellerId, sellsPrice, buyPrice, weight, color, year, generalState);
        if (this.id > 0) {
            this.id = id;
        }else{
            throw new IllegalArgumentException();
        }
    }
}
